package pub.guoxin.oops.manager.vo;

import com.google.common.collect.Lists;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.mongodb.morphia.annotations.Id;
import pub.guoxin.oops.model.RealTimeCommunication;
import pub.guoxin.oops.model.RealTimeDeviceDataInfo;

import java.util.List;
import java.util.Objects;

/**
 * Created by guoxin on 18-1-25.
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class RealTimeCommunicationVo {
    /**
     * 设备串号
     */
    @Id
    private String sn;
    /**
     * 分组Id
     */
    private String groupId;

    private String companyId;
    /**
     * 备注
     */
    private String remarks;
    /**
     * 电池电量
     */
    private Float batteryLevel;
    /**
     * 设备列表
     */
    private List<RealTimeDeviceDataInfo> devices = Lists.newArrayList();

    public RealTimeCommunicationVo(RealTimeCommunication realtimeCommunication, List<RealTimeDeviceDataInfo> devices){
        Objects.requireNonNull(realtimeCommunication);
        Objects.requireNonNull(devices);

        this.batteryLevel = realtimeCommunication.getBatteryLevel();
        this.companyId = realtimeCommunication.getCompanyId();
        this.devices = devices;
        this.groupId = realtimeCommunication.getGroupId();
        this.remarks = realtimeCommunication.getRemark();
        this.sn = realtimeCommunication.getId();
    }
}
